import request from '../utils/request'
// 编辑用户个人资料（包含实名认证）
export function editUserInfo (data) {
  return request({
    url: 'v1_0/user/profile',
    method: 'PATCH',
    needToken: true,
    data
  })
}

// 修改指定用户频道
export function editUserChannels (data) {
  return request({
    url: 'v1_0/user/channels/:target',
    method: 'PUT',
    needToken: true,
    data: data
  })
}

// 删除指定用户频道
export function delUserChannels (data) {
  return request({
    url: 'v1_0/user/channels/:target',
    method: 'DELETE',
    needToken: true,
    data: data
  })
}

// 刷新用户token
export function refresh (data) {
  return request({
    url: 'v1_0/authorizations',
    method: 'PUT',
    needToken: true,
    data: data
  })
}

// 渲染关注
export function attention (data) {
  return request({
    url: 'v1_0/user/followings',
    method: 'POST',
    data: data,
    needToken: true
  })
}

// 取消关注用户
export function Cancelattention (data) {
  return request({
    url: `v1_0/user/followings/${data}`,
    method: 'DELETE',
    needToken: true
  })
}

// 取消拉黑用户
export function CancelBlack (data) {
  return request({
    url: 'v1_0/user/blacklists/:target',
    method: 'DELETE',
    needToken: true,
    data: data
  })
}
// 拉黑用户
export function blackUser (data) {
  return request({
    url: 'v1_0/user/blacklists',
    method: 'POST',
    needToken: true,
    data: data
  })
}

// 获取指定用户信息
export function getAppointUserInfo (params) {
  return request({
    url: 'v1_0/users/:target',
    method: 'GET',
    needToken: true,
    params: params
  })
}

// 获取用户资料
export function getUserInfo (params) {
  return request({
    url: 'v1_0/user/profile',
    method: 'GET',
    needToken: true,
    params: params
  })
}

// 关注
export function getUserFollowList (params) {
  return request({
    url: 'v1_0/user/followings',
    method: 'GET',
    params: params,
    needToken: true
  })
}

// 获取用户的粉丝列表
export function getUserFansList (params) {
  return request({
    url: 'v1_0/user/followers',
    method: 'GET',
    needToken: true,
    params: params
  })
}

// 获取用户的统计数据
export function getUserStatisticsData () {
  return request({
    url: 'v1_0/user/figure',
    method: 'GET',
    needToken: true
  })
}

// 获取用户自己信息
export function getUserPersonalInfo (params) {
  return request({
    url: 'v1_0/user',
    method: 'GET',
    needToken: true,
    params: params
  })
}

// 获取用户频道列表
export function getUserChannelList (params) {
  return request({
    url: 'v1_0/user/channels',
    method: 'GET',
    needToken: true,
    params: params
  })
}

// 获取用户频道列表(增量式)
export function getUserChannelListadd (data) {
  return request({
    url: 'v1_0/user/channels',
    method: 'POST',
    needToken: true,
    data: data
  })
}

// 批量修改用户频道列表（重置式）
export function getUserChannelListReset (data) {
  return request({
    url: 'v1_0/user/channels',
    method: 'PUT',
    needToken: true,
    data: data
  })
}

// 获取短信验证码
export function getMsgCode (params) {
  return request({
    url: 'v1_0/sms/codes/:mobile',
    method: 'GET',
    needToken: true,
    params: params
  })
}

//  设置用户频道列表
export function setUserChannelList (params) {
  return request({
    url: 'v1_0/user/channels',
    method: 'GET',
    needToken: true,
    params: params
  })
}

// 获取用户的关注列表
export function getUserList (params) {
  return request({
    url: 'v1_0/user/followings',
    method: 'GET',
    needToken: true,
    params: params
  })
}

// 编辑用户照片资料（头像）
export function editUserPhoto (data) {
  return request({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    needToken: true,
    data: data
  })
}

export function getallUserList (target) {
  return request({
    url: `v1_0/users/${target}`,
    needToken: true
  })
}
